home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / BPC-DE10.ZIP / DOOR.PAS < prev    next >
Pascal/Delphi Source File  |  1995-09-05  |  2KB  |  107 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Turbo Pascal Version 7.0                        }
  5. {       Doors Engine Example Program                    }
  6. {                                                       }
  7. {       Copyright (c) 1995 by Solar Designer            }
  8. {                                                       }
  9. {*******************************************************}
  10.  
  11. {$A+,B-,D+,E-,F-,G+,I-,L+,N-,O-,P-,Q-,R-,S-,T-,V+,X+}
  12. {$M 1024,4000,4000}
  13. program Door;
  14.  
  15. uses
  16.    DOS,
  17.    InitPort, Fossil, SendANSI;
  18.  
  19. procedure Last16; assembler;
  20. asm
  21.    dd   0
  22.    dw   0
  23. end;
  24.  
  25. procedure Int16; assembler;
  26. asm
  27.    cmp  byte ptr cs:Last16+6,0
  28.    jz   @@JmpLast
  29.  
  30.    or   ah,ah
  31.    jnz  @@Fn1
  32.  
  33.    mov  byte ptr cs:Last16+6,0
  34.  
  35.    push ds
  36.    push es
  37.    pusha
  38.    push seg @DATA
  39.    pop  ds
  40.  
  41.    call GetEvent
  42.    mov  word ptr cs:Last16+4,ax
  43.  
  44.    popa
  45.    pop  es
  46.    pop  ds
  47.    mov  ax,word ptr cs:Last16+4
  48.  
  49.    not  byte ptr cs:Last16+6
  50.    iret
  51.  
  52. @@Fn1:
  53.    cmp  ah,1
  54.    jne  @@JmpLast
  55.  
  56.    pushf
  57.    call dword ptr cs:Last16
  58.    jnz  @@DoneFn1
  59.  
  60.    push ds
  61.    push es
  62.    pusha
  63.    push seg @DATA
  64.    pop  ds
  65.  
  66.    cmp  LocalMode,0
  67.    jnz  @@SkipRemote
  68.  
  69.    push seg Port
  70.    push offset Port
  71.    call TFossilPort.CharAvail
  72.    or   al,al
  73.    jnz  @@DoneRemote
  74.  
  75.    call UpdateSendANSI
  76.  
  77. @@SkipRemote:
  78.    xor  ax,ax
  79.  
  80. @@DoneRemote:
  81.    popa
  82.    pop  es
  83.    pop  ds
  84.  
  85. @@DoneFn1:
  86.    retf 2
  87.  
  88. @@JmpLast:
  89.    jmp  dword ptr cs:Last16
  90. end;
  91.  
  92. begin
  93.    if ParamCount<2 then
  94.       Abort(#1'Specify program name on the command line (second parameter)'#13#10'$');
  95.  
  96.    TimeLimit:=30*(182*6)-1;
  97.  
  98.    GetIntVec($16, Pointer(@Last16^));
  99.    SetIntVec($16, @Int16);
  100.  
  101.    SwapVectors;
  102.    Exec(GetEnv('COMSPEC'), '/C '+ParamStr(2));
  103.    SwapVectors;
  104.  
  105.    SetIntVec($16, Pointer(@Last16^));
  106. end.
  107.